package com.wayhome.springframework;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class BeanFactory {

    private Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>();


    public Object getBean(String beanName){
       return beanDefinitionMap.get(beanName).getBean();
    }

    public void beanDefinitionRegister(String beanName, BeanDefinition beanDefinition) {
        if (beanDefinitionMap.containsKey(beanName)){
            return;
        }
        beanDefinitionMap.put(beanName, beanDefinition);
    }
}
